/**
 * 
 */
package com.alstudio.module.xmpp.protocol.xmpp.util.xmlcreator.iq;

import java.util.ArrayList;

import com.alstudio.module.xmpp.protocol.xmpp.util.xmlcreator.AlXmlTag;

/**
 * @author alonso lee
 * 
 */
public abstract class BaseIQTemplate {

	protected ALIQCreator mALIQCreator = new ALIQCreator();
	protected ArrayList<AlXmlTag> tagList = new ArrayList<AlXmlTag>();
	
	public String IQ_TYPE_GET = "get";
	public String IQ_TYPE_SET = "set";
	public String IQ_TYPE_RESULT = "result";
	public String IQ_TYPE_ERROR = "error";
	protected String domain;
	protected String to;
	protected String start;
	protected String end;
	protected String jid;
	

	/**
	 * 此方法用于生成IQ XML
	 * @return
	 */
	public abstract String getIQXml();

	/**
	 * 释放资源
	 */
	public void release() {
		mALIQCreator.release();
	}
	
	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		// TODO Auto-generated method stub
		mALIQCreator.setTagList(tagList);
		return getIQXml();
	}

}
